<!-- Page statistics and control buttons area -->
    <div class="statsRow">
        <div class="wrapper statsItems">
        
            <!-- Stats item -->
            <div class="sItem ordersStats">
                <h2><a title="" class="value"><?php echo count($this->sites); ?><span>Websites</span></a></h2>
                <div class="statsDetailed" id="s4">
                    <div class="statsContent">
                        <div class="sElements">
                            <div class="sDisplay"><h4><?php echo count($this->active_sites); ?></h4><span>approved</span></div>
                            <div class="sDisplay"><h4><?php echo count($this->pending_sites); ?></h4><span>pending</span></div>
                            <div class="sDisplay"><h4><?php echo count($this->blocked_sites); ?></h4><span>blocked</span></div>
                        </div>
                        <span class="line"></span>
                        <div class="statsUpdate">
                            <span>Next update in:</span>
                            <span>1 hr 19 min</span>
                            <div class="contentProgress"><div class="barG tipS" id="bar4" title="89%"></div></div>
                        </div>
                        <div class="statsDropBtn"><a href="#" class="button basic"><img src="/images/icons/dark/stats.png" class="icon" alt="" /><span>View statistics</span></a></div>
                    </div>
                </div>
                <span class="changes">
                    <span class="negBar" values="5,10,15,20,25,30,35,40,45,50"></span>
                    <span class="negative">+0.6%</span>
                </span>
            </div>
			
	 <div class="sItem ordersStats">
                <h2><a title="" class="value"><?php echo count($this->total_adv); ?><span>Adspaces</span></a></h2>
                <div class="statsDetailed" id="s5">
                    <div class="statsContent">
                        <div class="sElements">
                            <div class="sDisplay"><h4><?php echo count($this->active_adv); ?></h4><span>approved</span></div>
                            <div class="sDisplay"><h4><?php echo count($this->pending_adv); ?></h4><span>pending</span></div>
                            <div class="sDisplay"><h4><?php echo count($this->blocked_adv); ?></h4><span>blocked</span></div>
                        </div>
                        <span class="line"></span>
                        <div class="statsUpdate">
                            <span>Next update in:</span>
                            <span>1 hr 19 min</span>
                            <div class="contentProgress"><div class="barG tipS" id="bar4" title="89%"></div></div>
                        </div>
                        <div class="statsDropBtn"><a href="#" class="button basic"><img src="/images/icons/dark/stats.png" class="icon" alt="" /><span>View statistics</span></a></div>
                    </div>
                </div>
                <span class="changes">
                    <span class="negBar" values="5,10,15,20,25,30,35,40,45,50"></span>
                    <span class="negative">+0.6%</span>
                </span>
            </div>
			
        </div>
    </div>
	<div class="line"></div>

    <!-- Main content wrapper -->
    <div class="wrapper">
    
        <!-- Dynamic table -->
        <div class="widget">
            <div class="title"><img src="/images/icons/dark/full2.png" alt="" class="titleIcon" /><h6>Dynamic table</h6></div>
            <table cellpadding="0" cellspacing="0" border="0" class="display dTable">
            <thead>
            <tr>
            <th>Адрес сайта</th>
			<th>Тематика сайта</th>
			<th>Ключевые слова</th>
            <th>Кол-во рекламных мест</th>
			<th>Статус</th>
            <th>Действия</th>
            </tr>
            </thead>
            <tbody>
            <?php foreach ($this->select as $site) { 
                //если статус 'Active' - белое поле
                if ($site['status'] === 'active') {    ?>
                    <tr class="gradeA">
                <?php } elseif ($site['status'] === 'blocked') { ?>
                    <tr class="gradeX">
                <?php } else { ?>
                    <tr class="gradeC"> 
                <?php } ?>   
                    <td> 
                        <a href="<?php echo $site['url']; ?>" target="_blank"><?php echo $site['url']; ?></a>                        
                    </td>
                    
                    <td><?php echo $site['name']; ?></td>
                    <td>
                    <?php 
                    foreach($site['key'] as $value) {
                        echo $value.' ';   
                    }                               
                    ?>
                    </td>
                                <td>12</td>
                                <td><?php echo $site['status']; ?></td>
                                <td>

                                    <?php
                                    if ($site['status'] === 'active') {
                                        //если активирован
                                        echo '<a href="'.$this->url(array(
                                            'module'     => 'pub',
                                            'controller' => 'publisher',
                                            'action'     => 'generateadv',
                                            'id'         => $site['id']
                                        )).'">generate</a>&nbsp;'; 
                                        echo '<a href="'.$this->url(array(
                                            'module'     => 'pub',
                                            'controller' => 'publisher',
                                            'action'     => 'selectsite',
                                            'id'         => $site['id']                        
                                        )).'">management &nbsp;</a>'; 
                                        echo '<a href="'.$this->url(array(
                                            'module'     => 'pub',
                                            'controller' => 'publisher',
                                            'action'     => 'statisticsite',
                                            'id'         => $site['id']
                                        )).'">statistic</a>&nbsp;';
                                        echo '<a href="'.$this->url(array(
                                            'module'     => 'pub',
                                            'controller' => 'publisher',
                                            'action'     => 'deletesite',
                                            'id'         => $site['id']
                                        )).'">delete</a>&nbsp;'; 
                                    //если заблокирован     
                                    } elseif($site['status'] === 'blocked') {
                                        echo '<a href="'.$this->url(array(
                                            'module'     => 'pub',
                                            'controller' => 'publisher',
                                            'action'     => 'selectsite',
                                            'id'         => $site['id']                        
                                        )).'">management &nbsp;</a>';
                                        echo '<a href="'.$this->url(array(
                                            'module'     => 'pub',
                                            'controller' => 'publisher',
                                            'action'     => 'statisticsite',
                                            'id'         => $site['id']
                                        )).'">statistic</a>&nbsp;';
                                        echo '<a href="'.$this->url(array(
                                            'module'     => 'pub',
                                            'controller' => 'publisher',
                                            'action'     => 'deletesite',
                                            'id'         => $site['id']
                                        )).'">delete</a>&nbsp;'; 
                                    } else {
                                        //если не подтвержден
                                        echo '<a href="'.$this->url(array(
                                            'module'     => 'pub',
                                            'controller' => 'publisher',
                                            'action'     => 'deletesite',
                                            'id'         => $site['id']
                                        )).'">delete</a>&nbsp;'; 
                                    }   
                                    ?>
                                </td>
                    </tr>
            <?php } ?>
            </tbody>
            </table>  
        </div>
    </div>